<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>
	<meta http-equiv="content-type" content="text/xml; charset=utf-8" /> 
    <title>Edit E-Book</title>
    <meta name="description" content=""  /> 
	<meta name="keywords" content=""  /> 
	<link rel="stylesheet" type="text/css" href="formatstyles.css"/> 
	<link rel="stylesheet" type="text/css" href="divstyles.css"/> 
    <link rel="stylesheet" type="text/css" href="style/css/jquery-ui-1.8.18.custom.css" />
	
	<!-- include CSS always before including js -->

	<!-- include jQuery library -->
	<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
	<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
	<script type="text/javascript" src="js/jquery.cycle.all.js"></script>
	<script type="text/javascript" src="js/scripts.js"></script>
	<script type="text/javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script>
	<script type="text/javascript" src="js/login.js"></script>
	<script type="text/javascript" src="js/comment.js"></script>
	<link rel="stylesheet" type="text/css" media="screen" href="style/css/demos.css"/>
	<style type="text/css" media="screen"> 
		@import "style/css/uni-form.css"; 
	</style>
	
	<!-- Demo page js -->
	<script type="text/javascript" src="js/jquery.uni-form.js"></script>
	
	<!-- Star Rating widget stuff here... -->
	<script type="text/javascript" src="js/jquery.ui.stars.js"></script>
	<link rel="stylesheet" type="text/css" href="style/css/crystal-stars.css"/>
	<link rel="stylesheet" type="text/css" href="style/css/jquery.ui.stars.css"/>
	<script type="text/javascript" src ="js/language-en.js"></script> 
	<script type="text/javascript" src ="js/nopcart.js" language="javascript"> 
	
      //============================================================== 
      //               NOP Design JavaScript Shopping Cart               
      //-------------------------------------------------------------- 
	  //       Visit NOP Design at http://www.nopdesign.com/freecart     
	  //============================================================== 
	</script> 
		
		<!-- Upload & Crop Image -->
		<link href="css/default.css" rel="stylesheet" type="text/css" />
		<link href="scripts/fileuploader/fileuploader.css" rel="stylesheet" type="text/css" />
		<link href="scripts/Jcrop/jquery.Jcrop.css" rel="stylesheet" type="text/css" />
		
		<script type="text/javascript" src="scripts/jquery-impromptu.js"></script>
		<script type="text/javascript" src="scripts/fileuploader/fileuploader.js"></script>
		<script type="text/javascript" src="scripts/Jcrop/jquery.Jcrop.min.js"></script>
		<script type="text/javascript" src="scripts/jquery-uberuploadcropper.js"></script>
		<script type="text/javascript" src="js/eupload.js"></script>

</head>

<body>
<div id="fade" style="display:none;"></div>
	<!-- This is the page section -->
	<div id="page_section">

		<!-- This is the banner --> 
		<div id="banner"> 
 			<?php include("banner.php"); ?>
		</div> 
		<!-- This is end of the banner --> 
    
    	<div id="user-cpanel">
		<?php include("user_cpanel.php"); ?>
		<?php include("session_admin.php"); ?>
        </div>
        <div class="wan-clear"></div>
        <div id="user-form">
       	<?php include("user-form.php"); ?>
		</div>
		<div id="topnav">
           <?php include("top-nav.php"); ?>
        </div>
		
		
		<div id="content">
        
        <?php
        	if (isset($_SESSION['login'])==true &&( $_SESSION['login'])==true && ($_SESSION['username']=="inte")) {
			
                echo '<div class="title-text">Edit E-Book</div>';
                          
                while($record = mysql_fetch_array($result)){
                    $name = $record['name'];
                    $author = $record['author'];
                    $price = $record['price'];
                    $description = $record['description'];
                    $link = $record['download'];
                    $image = $record['img'];
                
                	echo '
                    <center><form id="edit_ebook_form" method="post" enctype="multipart/form-data" action="update_ebook.php">
                        <table id="edit">
                            <tr>
                                <td>Ebook Name</td>
                                <td><input size="50" name="ebook_name" type="text" value="'.$name.'"/></td>
                                <input type="hidden" name="ebookID" value="'.$ebookID.'"/>
                            </tr>
 
                            <tr>
                                <td>Author</td>
                                <td><input size="50" type="text" name="author" value="'.$author.'"/></td>
                            </tr>
                            
                            <tr>
                                <td>Price</td>
                                <td><input size="50" type="text" name="price" value="'.$price.'"/></td>
                            </tr>
                            
                            <tr>
                                <td valign="top">Description</td>
                                <td><textarea name="description" rows="10" cols="39"/>'.$description.'</textarea></td>
                            </tr>
                            
                            <tr>
                                <td>Current E-Book file</td>
                                <td><input size="50" type="text" name="oldLink" value="'.$link.'" /></td>
                            </tr>
                            
                            <tr>
                                <td>New E-Book file</td>
                                <td><input size="25" type="file" name="file" /></td>
                            </tr>

                            <tr valign="top">
                                <td>Current Image</td>
                                <td>
                                	<img width ="300" height="200" src="'.$image.'" alt="Image cannot be load" title="Current Image" />
                                    <input type="hidden" value="'.$image.'" name="oldImg" />
								</td>
                                
                                <td>
                                    <div id="UploadEbookImg">
                                        <noscript>Please enable javascript to upload and crop images.</noscript>
                                    </div>
            					</td>
                                
                                <td>
                                    <div id="ImgPrevs">
                                        <!-- The cropped images will be populated here -->
                                    </div>                                                                            
                                </td>
                            </tr>

                            <tr>
                                <td id="edit_ebook_submit" colspan="4" align="center">
                                    <input type="submit" value="Submit"/>
                                    <input type="reset" value="Reset"/>	    
                                </td>
                            </tr>
						</table>
					</form></center>';
				}
			} else {
            	include("notice.php");
            }                
        ?>
		</div>
	
		<div class="wan-clear"></div>
		
<!-- This is end of the content -->
	</div> 
<!-- This is end of the page section -->
<br />
<!-- This is the footer -->
		<div id="footer"> 
			<p class="footer">This website is a student project that is intended to be used only for academic purposes. This page was created by Long, Tran Hoang </p>
		</div> 
<!-- This is end of the footer -->
</body>

</html>